package com.soul;


import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

public class TestLog4j2 {
    /**
     * 创建日志实例 
     * (开启log4j2的全异步配置)
     * -Dlog4j2.contextSelector=org.apache.logging.log4j.core.async.AsyncLoggerContextSelector
     */
    private static Logger log = LogManager.getLogger(TestLog4j2.class);

    public static void main(String[] args) {
        log.trace("this is trace log message");
        log.debug("this is debug log message");
        log.info("this is info log message");
        log.warn("this is warn log message");
        log.error("this is error log message");
        log.fatal("this is fatal log message");
        // 异步日志处理，使用以下方式可以避免使用 log.isInfoEnable()
        //log.error("lambda error",() -> dolog());
    }
}
